package com.example.demo.Configuration;

import com.example.demo.Service.UserService;
import com.example.demo.model.Student;
import com.example.demo.model.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * Description:
 * Date: 2024-07-30
 * Time: 13:34
 */
@Component
public class BeanConfig {
/*
    @Bean
    public Student student1() {
        Student student = new Student();
        student.setAge(20);
        student.setName("Zhangsan");
        student.setId(7);
        return student;
    }

    @Bean
    public Student student2() {
        Student student = new Student();
        student.setAge(24);
        student.setName("Xianbei");
        student.setId(114);
        return student;
    }
*/
    @Primary
    @Bean
    public User user1() {
        User user = new User();
        user.setAge(24);
        user.setName("zhangsan");
        return user;
    }

    @Bean
    public User user2() {
        User user = new User();
        user.setAge(20);
        user.setName("lisi");
        return user;
    }
}
